package demo2;

import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        final int mod = 1000007;
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()) {
            String s1 = scanner.next();
            String s2 = scanner.next();
            int l1 = scanner.nextInt();
            int l2 = scanner.nextInt();
            StringBuffer str1 = new StringBuffer(s1);
            StringBuffer str2 = new StringBuffer(s2);

            while(str1.length() < l2) {
                str1.append('a');
            }
            while(str2.length() < l2) {
                str2.append('z' + 1);
            }

            int sum = 0;
            int t = 0;
            for(int i = 0; i< l2; i++) {
                t *= 26;
                t += str2.charAt(i)-str1.charAt(i);
                t %= mod;
                if(i>=l1-1) {
                    sum += t;
                    sum %= mod;
                }
            }

            System.out.println(sum-1);
        }
    }
}